//
//  HGEstMainVC.m
//  RedWinMall
//
//  Created by HeDianZhao on 2018/8/6.
//  Copyright © 2018年 HeDianZhao. All rights reserved.
//

#import "HGEstMainVC.h"
#import "LTScrollView-Swift.h"
#import "HGFansVC.h"
#import "HGDividendVC.h"

@interface HGEstMainVC ()<LTAdvancedScrollViewDelegate>

@property(copy, nonatomic) NSArray <UIViewController *> *viewControllers;
@property(copy, nonatomic) NSArray <NSString *> *titles;
@property(strong, nonatomic) LTLayout *layout;
@property(strong, nonatomic) LTAdvancedManager *managerView;

@end

@implementation HGEstMainVC

- (void)viewDidLoad {
    [super viewDidLoad];
 
    [self setupSubViews];
}

-(void)setupSubViews {
    
    self.title = @"我的粉丝";
    
    [self.view addSubview:self.managerView];
    
    [self.managerView setAdvancedDidSelectIndexHandle:^(NSInteger index) {
        NSLog(@"%ld", index);
    }];
}

-(LTAdvancedManager *)managerView {
    if (!_managerView) {
        _managerView = [[LTAdvancedManager alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, kScreenHeight-kNavigationHeight) viewControllers:self.viewControllers titles:self.titles currentViewController:self layout:self.layout headerViewHandle:^UIView * _Nonnull{
            return [UIView new];
        }];
        
        /* 设置代理 监听滚动 */
        _managerView.delegate = self;
        
        /* 点击切换滚动过程动画 */
        _managerView.isClickScrollAnimation = YES;
    }
    return _managerView;
}


-(void)glt_scrollViewOffsetY:(CGFloat)offsetY {
    NSLog(@"---> %lf", offsetY);
}


- (NSArray <NSString *> *)titles {
    if (!_titles) {
        _titles = @[@"我的粉丝", @"我的奖励"];
    }
    return _titles;
}

-(NSArray <UIViewController *> *)viewControllers {
    if (!_viewControllers) {
        _viewControllers = [self setupViewControllers];
    }
    return _viewControllers;
}


-(LTLayout *)layout {
    if (!_layout) {
        _layout = [[LTLayout alloc] init];
        _layout.isAverage = YES;
        _layout.sliderWidth = 50;
        _layout.titleViewBgColor = kColorWithRGB(255, 255, 255);
        _layout.titleColor = kColorWithRGB(51, 51, 51);
        _layout.titleSelectColor = kColorWithRGB(0, 0, 0);
        _layout.bottomLineColor = kColorMainTheme;
        _layout.titleFont = [UIFont systemFontOfSize:13];
    }
    return _layout;
}

-(NSArray <UIViewController *> *)setupViewControllers {
    HGFansVC *fansVC = [HGFansVC new];
    HGDividendVC *vc = [HGDividendVC new];
    NSArray *vcs = @[fansVC,vc];
    return vcs.copy;
}




@end
